import java.util.HashSet;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-12-12
 * Time: 18:07
 */
public class Demo2 {

    public static boolean fly(char ch) {
        return ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z';
    }
    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        while(scan.hasNext()) {
            String str = scan.nextLine();
            String strLine = "";
            int fly = 0;
            
            for(int i = 0; i < str.length(); i++ ) {
                
                if(fly(str.charAt(i))) {
                    strLine += str.charAt(i);
                    fly = 0;
                }else {
                    if(fly == 0) {
                        strLine += ' ';
                        fly++;
                    }
                }
            }
            
            String[] arr = strLine.split(" ");
            
            for(int i = arr.length - 1; i >= 0; i--) { 
                System.out.print(arr[i]);
                if(i > 0) {
                    System.out.print(" ");
                }
            }
           
        }
        
    }
}
